package com.weareint.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
 *
 * <pre>
 *      BizException
 * </pre>
 *
 * @author Johnny
 * @date 2021-09-28
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
public class BizException extends RuntimeException {
    /** 错误码 */
    protected String errorCode;
    /** 错误信息 */
    protected String errorMsg;

    public BizException(String errorCode, String errorMsg) {
        super(errorCode);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BizException(BaseErrorInterface commonEnum) {
        super(commonEnum.getResultCode());
        this.errorCode = commonEnum.getResultCode();
        this.errorMsg = commonEnum.getResultMsg();
    }
}

